<template>
  <ContentWrap>
    <el-descriptions :column="1" border>
      <el-descriptions-item label="补卡日期">
        {{ formatDate(detailData.reissueDate, 'YYYY-MM-DD') }}
      </el-descriptions-item>
      <el-descriptions-item label="补卡类型">
        <dict-tag :type="DICT_TYPE.BPM_REISSUE_TYPE" :value="detailData.reissueType" />
      </el-descriptions-item>
      
      <el-descriptions-item label="补卡原因">
        {{ detailData.reason }}
      </el-descriptions-item>
    </el-descriptions>
  </ContentWrap>
</template>
<script lang="ts" setup>
import { DICT_TYPE } from '@/utils/dict'
import { formatDate } from '@/utils/formatTime'
import { propTypes } from '@/utils/propTypes'
import { OaReissueCardApplyApi, OaReissueCardApplyVO } from '@/api/bpm/oareissuecardapply'

defineOptions({ name: 'BpmOaReissueCardApplyDetail' })

const { query } = useRoute() // 查询参数

const props = defineProps({
  id: propTypes.number.def(undefined)
})
const detailLoading = ref(false) // 表单的加载中
const detailData = ref<any>({}) // 详情数据
const queryId = query.id as unknown as number // 从 URL 传递过来的 id 编号

/** 获得数据 */
const getInfo = async () => {
  detailLoading.value = true
  try {
    detailData.value = await OaReissueCardApplyApi.getOaReissueCardApply(props.id || queryId)
  } finally {
    detailLoading.value = false
  }
}
defineExpose({ open: getInfo }) // 提供 open 方法，用于打开弹窗

/** 初始化 **/
onMounted(() => {
  getInfo()
})
</script>
